


###########################################################################
########## All UN Members				###############
###########################################################################


data <- read.csv("UNHCR_Data_08052016.csv", sep=",", header=TRUE)
data <- data[data$hrc_member==1,]
myvars <- c("year","latentmean")
data1 <- data[myvars]
data1 <- na.omit(data1)
dim(data)

hrc1998 <- data1[data1$year==1998,]
hrc1999 <- data1[data1$year==1999,]
hrc2000 <- data1[data1$year==2000,]
hrc2001 <- data1[data1$year==2001,]
hrc2002 <- data1[data1$year==2002,]
hrc2003 <- data1[data1$year==2003,]
hrc2004 <- data1[data1$year==2004,]
hrc2005 <- data1[data1$year==2005,]
hrc2006 <- data1[data1$year==2006,]
hrc2007 <- data1[data1$year==2007,]
hrc2008 <- data1[data1$year==2008,]
hrc2009 <- data1[data1$year==2009,]
hrc2010 <- data1[data1$year==2010,]
hrc2011 <- data1[data1$year==2011,]
hrc2012 <- data1[data1$year==2012,]
hrc2013 <- data1[data1$year==2013,]


data <- read.csv("UNHCR_Data_08052016.csv", sep=",", header=TRUE)
data <- data[data$un_member==1,]
data <- data[data$hrc_member!=1,]
myvars <- c("year","latentmean")
data1 <- data[myvars]
data1 <- na.omit(data1)
dim(data)

un_hrc1998 <- data1[data1$year==1998,]
un_hrc1999 <- data1[data1$year==1999,]
un_hrc2000 <- data1[data1$year==2000,]
un_hrc2001 <- data1[data1$year==2001,]
un_hrc2002 <- data1[data1$year==2002,]
un_hrc2003 <- data1[data1$year==2003,]
un_hrc2004 <- data1[data1$year==2004,]
un_hrc2005 <- data1[data1$year==2005,]
un_hrc2006 <- data1[data1$year==2006,]
un_hrc2007 <- data1[data1$year==2007,]
un_hrc2008 <- data1[data1$year==2008,]
un_hrc2009 <- data1[data1$year==2009,]
un_hrc2010 <- data1[data1$year==2010,]
un_hrc2011 <- data1[data1$year==2011,]
un_hrc2012 <- data1[data1$year==2012,]
un_hrc2013 <- data1[data1$year==2013,]

m1998 <- mean(un_hrc1998$latentmean) 
m1999 <- mean(un_hrc1999$latentmean) 
m2000 <- mean(un_hrc2000$latentmean) 
m2001 <- mean(un_hrc2001$latentmean) 
m2002 <- mean(un_hrc2002$latentmean) 
m2003 <- mean(un_hrc2003$latentmean) 
m2004 <- mean(un_hrc2004$latentmean) 
m2005 <- mean(un_hrc2005$latentmean) 
m2006 <- mean(un_hrc2006$latentmean) 
m2007 <- mean(un_hrc2007$latentmean) 
m2008 <- mean(un_hrc2008$latentmean) 
m2009 <- mean(un_hrc2009$latentmean) 
m2010 <- mean(un_hrc2010$latentmean) 
m2011 <- mean(un_hrc2011$latentmean) 
m2012 <- mean(un_hrc2012$latentmean) 
m2013 <- mean(un_hrc2013$latentmean) 

c1998 <- mean(hrc1998$latentmean) 
c1999 <- mean(hrc1999$latentmean) 
c2000 <- mean(hrc2000$latentmean) 
c2001 <- mean(hrc2001$latentmean) 
c2002 <- mean(hrc2002$latentmean) 
c2003 <- mean(hrc2003$latentmean) 
c2004 <- mean(hrc2004$latentmean) 
c2005 <- mean(hrc2005$latentmean) 
c2006 <- mean(hrc2006$latentmean) 
c2007 <- mean(hrc2007$latentmean) 
c2008 <- mean(hrc2008$latentmean) 
c2009 <- mean(hrc2009$latentmean) 
c2010 <- mean(hrc2010$latentmean) 
c2011 <- mean(hrc2011$latentmean) 
c2012 <- mean(hrc2012$latentmean) 
c2013 <- mean(hrc2013$latentmean) 

adjust <- 0.25
y1 <- c(m1998,m1999,m2000,m2001,m2002,m2003,m2004,m2005,m2006,m2007,m2008,m2009,m2010,m2011,m2012,m2013)
x1 <- c(1998:2013)

y2 <- c(c1998,c1999,c2000,c2001,c2002,c2003,c2004,c2005,c2006,c2007,c2008,c2009,c2010,c2011,c2012,c2013)
x2 <- c(1998:2013)


par(mar=c(4,4,3,2),xpd=FALSE,mfrow=c(3,2),oma=c(0,0,0,0))
plot(x1,y1,xlab="Year",xlim=c(1998,2013),ylim=c(-0.25,1.25),pch=19,col="dodgerblue",frame.plot=T,axes=F,ylab="Human Rights Score",main="All Members")
points(x2,y2,col="coral",pch=21)

abline(v=2005.5,lty=2)
lines(x1, y1, type = "l",col="dodgerblue",lwd=3)
lines(x2, y2, type = "l",col="coral")


x.axis <- c(1998:2013)
X <- c("'98","'99","'00","'01","'02","'03","'04","'05","'06","'07","'08","'09","'10","'11","'12","'13")
axis(1,at = x.axis,labels=X)

y.axis <- c(-0.25,0.5,1.25)
Y <- c("-0.25","0.5","1.25")
axis(2,at = y.axis,labels=Y)

###########################################################################
########## Africa   				###############
###########################################################################



data <- read.csv("UNHCR_Data_08052016.csv", sep=",", header=TRUE)
data <- data[data$region=="Africa",]
data <- data[data$hrc_member==1,]
myvars <- c("year","latentmean")
data1 <- data[myvars]
data1 <- na.omit(data1)
dim(data)

hrc1998 <- data1[data1$year==1998,]
hrc1999 <- data1[data1$year==1999,]
hrc2000 <- data1[data1$year==2000,]
hrc2001 <- data1[data1$year==2001,]
hrc2002 <- data1[data1$year==2002,]
hrc2003 <- data1[data1$year==2003,]
hrc2004 <- data1[data1$year==2004,]
hrc2005 <- data1[data1$year==2005,]
hrc2006 <- data1[data1$year==2006,]
hrc2007 <- data1[data1$year==2007,]
hrc2008 <- data1[data1$year==2008,]
hrc2009 <- data1[data1$year==2009,]
hrc2010 <- data1[data1$year==2010,]
hrc2011 <- data1[data1$year==2011,]
hrc2012 <- data1[data1$year==2012,]
hrc2013 <- data1[data1$year==2013,]

data <- read.csv("UNHCR_Data_08052016.csv", sep=",", header=TRUE)
data <- data[data$region=="Africa",]
data <- data[data$un_member==1,]
data <- data[data$hrc_member!=1,]
myvars <- c("year","latentmean")
data1 <- data[myvars]
data1 <- na.omit(data1)
dim(data)

un_hrc1998 <- data1[data1$year==1998,]
un_hrc1999 <- data1[data1$year==1999,]
un_hrc2000 <- data1[data1$year==2000,]
un_hrc2001 <- data1[data1$year==2001,]
un_hrc2002 <- data1[data1$year==2002,]
un_hrc2003 <- data1[data1$year==2003,]
un_hrc2004 <- data1[data1$year==2004,]
un_hrc2005 <- data1[data1$year==2005,]
un_hrc2006 <- data1[data1$year==2006,]
un_hrc2007 <- data1[data1$year==2007,]
un_hrc2008 <- data1[data1$year==2008,]
un_hrc2009 <- data1[data1$year==2009,]
un_hrc2010 <- data1[data1$year==2010,]
un_hrc2011 <- data1[data1$year==2011,]
un_hrc2012 <- data1[data1$year==2012,]
un_hrc2013 <- data1[data1$year==2013,]

m1998 <- mean(un_hrc1998$latentmean) 
m1999 <- mean(un_hrc1999$latentmean) 
m2000 <- mean(un_hrc2000$latentmean) 
m2001 <- mean(un_hrc2001$latentmean) 
m2002 <- mean(un_hrc2002$latentmean) 
m2003 <- mean(un_hrc2003$latentmean) 
m2004 <- mean(un_hrc2004$latentmean) 
m2005 <- mean(un_hrc2005$latentmean) 
m2006 <- mean(un_hrc2006$latentmean) 
m2007 <- mean(un_hrc2007$latentmean) 
m2008 <- mean(un_hrc2008$latentmean) 
m2009 <- mean(un_hrc2009$latentmean) 
m2010 <- mean(un_hrc2010$latentmean) 
m2011 <- mean(un_hrc2011$latentmean) 
m2012 <- mean(un_hrc2012$latentmean) 
m2013 <- mean(un_hrc2013$latentmean) 

c1998 <- mean(hrc1998$latentmean) 
c1999 <- mean(hrc1999$latentmean) 
c2000 <- mean(hrc2000$latentmean) 
c2001 <- mean(hrc2001$latentmean) 
c2002 <- mean(hrc2002$latentmean) 
c2003 <- mean(hrc2003$latentmean) 
c2004 <- mean(hrc2004$latentmean) 
c2005 <- mean(hrc2005$latentmean) 
c2006 <- mean(hrc2006$latentmean) 
c2007 <- mean(hrc2007$latentmean) 
c2008 <- mean(hrc2008$latentmean) 
c2009 <- mean(hrc2009$latentmean) 
c2010 <- mean(hrc2010$latentmean) 
c2011 <- mean(hrc2011$latentmean) 
c2012 <- mean(hrc2012$latentmean) 
c2013 <- mean(hrc2013$latentmean) 

adjust <- 0.25
y1 <- c(m1998,m1999,m2000,m2001,m2002,m2003,m2004,m2005,m2006,m2007,m2008,m2009,m2010,m2011,m2012,m2013)
x1 <- c(1998:2013)

y2 <- c(c1998,c1999,c2000,c2001,c2002,c2003,c2004,c2005,c2006,c2007,c2008,c2009,c2010,c2011,c2012,c2013)
x2 <- c(1998:2013)


plot(x1,y1,main="Africa",xlab="Year",xlim=c(1998,2013),ylim=c(-0.75,0.75),pch=19,col="dodgerblue",frame.plot=T,axes=F,ylab="Human Rights Score")
points(x2,y2,col="coral",pch=21)

abline(v=2005.5,lty=2)
lines(x1, y1, type = "l",col="dodgerblue",lwd=3)
lines(x2, y2, type = "l",col="coral")



x.axis <- c(1998:2013)
X <- c("'98","'99","'00","'01","'02","'03","'04","'05","'06","'07","'08","'09","'10","'11","'12","'13")
axis(1,at = x.axis,labels=X)

y.axis <- c(-0.75,0.0,0.75)
Y <- c("-0.75","0.0","0.75")
axis(2,at = y.axis,labels=Y)


###########################################################################
########## Asia Pacific      				###############
###########################################################################

data <- read.csv("UNHCR_Data_08052016.csv", sep=",", header=TRUE)
data <- data[data$region=="Asia-Pacific",]
data <- data[data$hrc_member==1,]
myvars <- c("year","latentmean")
data1 <- data[myvars]
data1 <- na.omit(data1)
dim(data)

hrc1998 <- data1[data1$year==1998,]
hrc1999 <- data1[data1$year==1999,]
hrc2000 <- data1[data1$year==2000,]
hrc2001 <- data1[data1$year==2001,]
hrc2002 <- data1[data1$year==2002,]
hrc2003 <- data1[data1$year==2003,]
hrc2004 <- data1[data1$year==2004,]
hrc2005 <- data1[data1$year==2005,]
hrc2006 <- data1[data1$year==2006,]
hrc2007 <- data1[data1$year==2007,]
hrc2008 <- data1[data1$year==2008,]
hrc2009 <- data1[data1$year==2009,]
hrc2010 <- data1[data1$year==2010,]
hrc2011 <- data1[data1$year==2011,]
hrc2012 <- data1[data1$year==2012,]
hrc2013 <- data1[data1$year==2013,]

data <- read.csv("UNHCR_Data_08052016.csv", sep=",", header=TRUE)
data <- data[data$region=="Asia-Pacific",]
data <- data[data$un_member==1,]
data <- data[data$hrc_member!=1,]
myvars <- c("year","latentmean")
data1 <- data[myvars]
data1 <- na.omit(data1)
dim(data)

un_hrc1998 <- data1[data1$year==1998,]
un_hrc1999 <- data1[data1$year==1999,]
un_hrc2000 <- data1[data1$year==2000,]
un_hrc2001 <- data1[data1$year==2001,]
un_hrc2002 <- data1[data1$year==2002,]
un_hrc2003 <- data1[data1$year==2003,]
un_hrc2004 <- data1[data1$year==2004,]
un_hrc2005 <- data1[data1$year==2005,]
un_hrc2006 <- data1[data1$year==2006,]
un_hrc2007 <- data1[data1$year==2007,]
un_hrc2008 <- data1[data1$year==2008,]
un_hrc2009 <- data1[data1$year==2009,]
un_hrc2010 <- data1[data1$year==2010,]
un_hrc2011 <- data1[data1$year==2011,]
un_hrc2012 <- data1[data1$year==2012,]
un_hrc2013 <- data1[data1$year==2013,]

m1998 <- mean(un_hrc1998$latentmean) 
m1999 <- mean(un_hrc1999$latentmean) 
m2000 <- mean(un_hrc2000$latentmean) 
m2001 <- mean(un_hrc2001$latentmean) 
m2002 <- mean(un_hrc2002$latentmean) 
m2003 <- mean(un_hrc2003$latentmean) 
m2004 <- mean(un_hrc2004$latentmean) 
m2005 <- mean(un_hrc2005$latentmean) 
m2006 <- mean(un_hrc2006$latentmean) 
m2007 <- mean(un_hrc2007$latentmean) 
m2008 <- mean(un_hrc2008$latentmean) 
m2009 <- mean(un_hrc2009$latentmean) 
m2010 <- mean(un_hrc2010$latentmean) 
m2011 <- mean(un_hrc2011$latentmean) 
m2012 <- mean(un_hrc2012$latentmean) 
m2013 <- mean(un_hrc2013$latentmean) 

c1998 <- mean(hrc1998$latentmean) 
c1999 <- mean(hrc1999$latentmean) 
c2000 <- mean(hrc2000$latentmean) 
c2001 <- mean(hrc2001$latentmean) 
c2002 <- mean(hrc2002$latentmean) 
c2003 <- mean(hrc2003$latentmean) 
c2004 <- mean(hrc2004$latentmean) 
c2005 <- mean(hrc2005$latentmean) 
c2006 <- mean(hrc2006$latentmean) 
c2007 <- mean(hrc2007$latentmean) 
c2008 <- mean(hrc2008$latentmean) 
c2009 <- mean(hrc2009$latentmean) 
c2010 <- mean(hrc2010$latentmean) 
c2011 <- mean(hrc2011$latentmean) 
c2012 <- mean(hrc2012$latentmean) 
c2013 <- mean(hrc2013$latentmean) 

adjust <- 0.25
y1 <- c(m1998,m1999,m2000,m2001,m2002,m2003,m2004,m2005,m2006,m2007,m2008,m2009,m2010,m2011,m2012,m2013)
x1 <- c(1998:2013)

y2 <- c(c1998,c1999,c2000,c2001,c2002,c2003,c2004,c2005,c2006,c2007,c2008,c2009,c2010,c2011,c2012,c2013)
x2 <- c(1998:2013)


plot(x1,y1,main="Asia-Pacific",xlab="Year",xlim=c(1998,2013),ylim=c(-0.5,1.1),pch=19,col="dodgerblue",frame.plot=T,axes=F,ylab="Human Rights Score")
points(x2,y2,col="coral",pch=21)

abline(v=2005.5,lty=2)
lines(x1, y1, type = "l",col="dodgerblue",lwd=3)
lines(x2, y2, type = "l",col="coral")



x.axis <- c(1998:2013)
X <- c("'98","'99","'00","'01","'02","'03","'04","'05","'06","'07","'08","'09","'10","'11","'12","'13")
axis(1,at = x.axis,labels=X)

y.axis <- c(-0.5,0.25,1.0)
Y <- c("-0.5","0.25","1.0")
axis(2,at = y.axis,labels=Y)


###########################################################################
########## Eastern Europe   				###############
###########################################################################

data <- read.csv("UNHCR_Data_08052016.csv", sep=",", header=TRUE)
data <- data[data$region=="Eastern Europe",]
data <- data[data$hrc_member==1,]
myvars <- c("year","latentmean")
data1 <- data[myvars]
data1 <- na.omit(data1)
dim(data)

hrc1998 <- data1[data1$year==1998,]
hrc1999 <- data1[data1$year==1999,]
hrc2000 <- data1[data1$year==2000,]
hrc2001 <- data1[data1$year==2001,]
hrc2002 <- data1[data1$year==2002,]
hrc2003 <- data1[data1$year==2003,]
hrc2004 <- data1[data1$year==2004,]
hrc2005 <- data1[data1$year==2005,]
hrc2006 <- data1[data1$year==2006,]
hrc2007 <- data1[data1$year==2007,]
hrc2008 <- data1[data1$year==2008,]
hrc2009 <- data1[data1$year==2009,]
hrc2010 <- data1[data1$year==2010,]
hrc2011 <- data1[data1$year==2011,]
hrc2012 <- data1[data1$year==2012,]
hrc2013 <- data1[data1$year==2013,]

data <- read.csv("UNHCR_Data_08052016.csv", sep=",", header=TRUE)
data <- data[data$region=="Eastern Europe",]
data <- data[data$un_member==1,]
data <- data[data$hrc_member!=1,]
myvars <- c("year","latentmean")
data1 <- data[myvars]
data1 <- na.omit(data1)
dim(data)

un_hrc1998 <- data1[data1$year==1998,]
un_hrc1999 <- data1[data1$year==1999,]
un_hrc2000 <- data1[data1$year==2000,]
un_hrc2001 <- data1[data1$year==2001,]
un_hrc2002 <- data1[data1$year==2002,]
un_hrc2003 <- data1[data1$year==2003,]
un_hrc2004 <- data1[data1$year==2004,]
un_hrc2005 <- data1[data1$year==2005,]
un_hrc2006 <- data1[data1$year==2006,]
un_hrc2007 <- data1[data1$year==2007,]
un_hrc2008 <- data1[data1$year==2008,]
un_hrc2009 <- data1[data1$year==2009,]
un_hrc2010 <- data1[data1$year==2010,]
un_hrc2011 <- data1[data1$year==2011,]
un_hrc2012 <- data1[data1$year==2012,]
un_hrc2013 <- data1[data1$year==2013,]

m1998 <- mean(un_hrc1998$latentmean) 
m1999 <- mean(un_hrc1999$latentmean) 
m2000 <- mean(un_hrc2000$latentmean) 
m2001 <- mean(un_hrc2001$latentmean) 
m2002 <- mean(un_hrc2002$latentmean) 
m2003 <- mean(un_hrc2003$latentmean) 
m2004 <- mean(un_hrc2004$latentmean) 
m2005 <- mean(un_hrc2005$latentmean) 
m2006 <- mean(un_hrc2006$latentmean) 
m2007 <- mean(un_hrc2007$latentmean) 
m2008 <- mean(un_hrc2008$latentmean) 
m2009 <- mean(un_hrc2009$latentmean) 
m2010 <- mean(un_hrc2010$latentmean) 
m2011 <- mean(un_hrc2011$latentmean) 
m2012 <- mean(un_hrc2012$latentmean) 
m2013 <- mean(un_hrc2013$latentmean) 

c1998 <- mean(hrc1998$latentmean) 
c1999 <- mean(hrc1999$latentmean) 
c2000 <- mean(hrc2000$latentmean) 
c2001 <- mean(hrc2001$latentmean) 
c2002 <- mean(hrc2002$latentmean) 
c2003 <- mean(hrc2003$latentmean) 
c2004 <- mean(hrc2004$latentmean) 
c2005 <- mean(hrc2005$latentmean) 
c2006 <- mean(hrc2006$latentmean) 
c2007 <- mean(hrc2007$latentmean) 
c2008 <- mean(hrc2008$latentmean) 
c2009 <- mean(hrc2009$latentmean) 
c2010 <- mean(hrc2010$latentmean) 
c2011 <- mean(hrc2011$latentmean) 
c2012 <- mean(hrc2012$latentmean) 
c2013 <- mean(hrc2013$latentmean) 

adjust <- 0.25
y1 <- c(m1998,m1999,m2000,m2001,m2002,m2003,m2004,m2005,m2006,m2007,m2008,m2009,m2010,m2011,m2012,m2013)
x1 <- c(1998:2013)

y2 <- c(c1998,c1999,c2000,c2001,c2002,c2003,c2004,c2005,c2006,c2007,c2008,c2009,c2010,c2011,c2012,c2013)
x2 <- c(1998:2013)


plot(x1,y1,main="Eastern Europe",xlab="Year",xlim=c(1998,2013),ylim=c(-0.0,1.73),pch=19,col="dodgerblue",frame.plot=T,axes=F,ylab="Human Rights Score")
points(x2,y2,col="coral",pch=21)

abline(v=2005.5,lty=2)
lines(x1, y1, type = "l",col="dodgerblue",lwd=3)
lines(x2, y2, type = "l",col="coral")



x.axis <- c(1998:2013)
X <- c("'98","'99","'00","'01","'02","'03","'04","'05","'06","'07","'08","'09","'10","'11","'12","'13")
axis(1,at = x.axis,labels=X)

y.axis <- c(0.0,0.75,1.5)
Y <- c("0.0","0.75","1.5")
axis(2,at = y.axis,labels=Y)

###########################################################################
########## Latin America 				###############
###########################################################################

data <- read.csv("UNHCR_Data_08052016.csv", sep=",", header=TRUE)
data <- data[data$region=="Latin America and Caribbean",]
data <- data[data$hrc_member==1,]
myvars <- c("year","latentmean")
data1 <- data[myvars]
data1 <- na.omit(data1)
dim(data)

hrc1998 <- data1[data1$year==1998,]
hrc1999 <- data1[data1$year==1999,]
hrc2000 <- data1[data1$year==2000,]
hrc2001 <- data1[data1$year==2001,]
hrc2002 <- data1[data1$year==2002,]
hrc2003 <- data1[data1$year==2003,]
hrc2004 <- data1[data1$year==2004,]
hrc2005 <- data1[data1$year==2005,]
hrc2006 <- data1[data1$year==2006,]
hrc2007 <- data1[data1$year==2007,]
hrc2008 <- data1[data1$year==2008,]
hrc2009 <- data1[data1$year==2009,]
hrc2010 <- data1[data1$year==2010,]
hrc2011 <- data1[data1$year==2011,]
hrc2012 <- data1[data1$year==2012,]
hrc2013 <- data1[data1$year==2013,]

data <- read.csv("UNHCR_Data_08052016.csv", sep=",", header=TRUE)
data <- data[data$region=="Latin America and Caribbean",]
data <- data[data$un_member==1,]
data <- data[data$hrc_member!=1,]
myvars <- c("year","latentmean")
data1 <- data[myvars]
data1 <- na.omit(data1)
dim(data)

un_hrc1998 <- data1[data1$year==1998,]
un_hrc1999 <- data1[data1$year==1999,]
un_hrc2000 <- data1[data1$year==2000,]
un_hrc2001 <- data1[data1$year==2001,]
un_hrc2002 <- data1[data1$year==2002,]
un_hrc2003 <- data1[data1$year==2003,]
un_hrc2004 <- data1[data1$year==2004,]
un_hrc2005 <- data1[data1$year==2005,]
un_hrc2006 <- data1[data1$year==2006,]
un_hrc2007 <- data1[data1$year==2007,]
un_hrc2008 <- data1[data1$year==2008,]
un_hrc2009 <- data1[data1$year==2009,]
un_hrc2010 <- data1[data1$year==2010,]
un_hrc2011 <- data1[data1$year==2011,]
un_hrc2012 <- data1[data1$year==2012,]
un_hrc2013 <- data1[data1$year==2013,]

m1998 <- mean(un_hrc1998$latentmean) 
m1999 <- mean(un_hrc1999$latentmean) 
m2000 <- mean(un_hrc2000$latentmean) 
m2001 <- mean(un_hrc2001$latentmean) 
m2002 <- mean(un_hrc2002$latentmean) 
m2003 <- mean(un_hrc2003$latentmean) 
m2004 <- mean(un_hrc2004$latentmean) 
m2005 <- mean(un_hrc2005$latentmean) 
m2006 <- mean(un_hrc2006$latentmean) 
m2007 <- mean(un_hrc2007$latentmean) 
m2008 <- mean(un_hrc2008$latentmean) 
m2009 <- mean(un_hrc2009$latentmean) 
m2010 <- mean(un_hrc2010$latentmean) 
m2011 <- mean(un_hrc2011$latentmean) 
m2012 <- mean(un_hrc2012$latentmean) 
m2013 <- mean(un_hrc2013$latentmean) 

c1998 <- mean(hrc1998$latentmean) 
c1999 <- mean(hrc1999$latentmean) 
c2000 <- mean(hrc2000$latentmean) 
c2001 <- mean(hrc2001$latentmean) 
c2002 <- mean(hrc2002$latentmean) 
c2003 <- mean(hrc2003$latentmean) 
c2004 <- mean(hrc2004$latentmean) 
c2005 <- mean(hrc2005$latentmean) 
c2006 <- mean(hrc2006$latentmean) 
c2007 <- mean(hrc2007$latentmean) 
c2008 <- mean(hrc2008$latentmean) 
c2009 <- mean(hrc2009$latentmean) 
c2010 <- mean(hrc2010$latentmean) 
c2011 <- mean(hrc2011$latentmean) 
c2012 <- mean(hrc2012$latentmean) 
c2013 <- mean(hrc2013$latentmean) 

adjust <- 0.25
y1 <- c(m1998,m1999,m2000,m2001,m2002,m2003,m2004,m2005,m2006,m2007,m2008,m2009,m2010,m2011,m2012,m2013)
x1 <- c(1998:2013)

y2 <- c(c1998,c1999,c2000,c2001,c2002,c2003,c2004,c2005,c2006,c2007,c2008,c2009,c2010,c2011,c2012,c2013)
x2 <- c(1998:2013)


plot(x1,y1,main="Latin America and Caribbean",xlab="Year",xlim=c(1998,2013),ylim=c(-0.5,1.2),pch=19,col="dodgerblue",frame.plot=T,axes=F,ylab="Human Rights Score")
points(x2,y2,col="coral",pch=21)

abline(v=2005.5,lty=2)
lines(x1, y1, type = "l",col="dodgerblue",lwd=3)
lines(x2, y2, type = "l",col="coral")



x.axis <- c(1998:2013)
X <- c("'98","'99","'00","'01","'02","'03","'04","'05","'06","'07","'08","'09","'10","'11","'12","'13")
axis(1,at = x.axis,labels=X)

y.axis <- c(-0.5,0.25,1.0)
Y <- c("-0.5","0.25","1.0")
axis(2,at = y.axis,labels=Y)



###########################################################################
########## Western Europe ###############
###########################################################################

data <- read.csv("UNHCR_Data_08052016.csv", sep=",", header=TRUE)
data <- data[data$region=="Western Europe and Others",]
data <- data[data$hrc_member==1,]
myvars <- c("year","latentmean")
data1 <- data[myvars]
data1 <- na.omit(data1)
dim(data)

hrc1998 <- data1[data1$year==1998,]
hrc1999 <- data1[data1$year==1999,]
hrc2000 <- data1[data1$year==2000,]
hrc2001 <- data1[data1$year==2001,]
hrc2002 <- data1[data1$year==2002,]
hrc2003 <- data1[data1$year==2003,]
hrc2004 <- data1[data1$year==2004,]
hrc2005 <- data1[data1$year==2005,]
hrc2006 <- data1[data1$year==2006,]
hrc2007 <- data1[data1$year==2007,]
hrc2008 <- data1[data1$year==2008,]
hrc2009 <- data1[data1$year==2009,]
hrc2010 <- data1[data1$year==2010,]
hrc2011 <- data1[data1$year==2011,]
hrc2012 <- data1[data1$year==2012,]
hrc2013 <- data1[data1$year==2013,]

data <- read.csv("UNHCR_Data_08052016.csv", sep=",", header=TRUE)
data <- data[data$region=="Western Europe and Others",]
data <- data[data$un_member==1,]
data <- data[data$hrc_member!=1,]
myvars <- c("year","latentmean")
data1 <- data[myvars]
data1 <- na.omit(data1)
dim(data)

un_hrc1998 <- data1[data1$year==1998,]
un_hrc1999 <- data1[data1$year==1999,]
un_hrc2000 <- data1[data1$year==2000,]
un_hrc2001 <- data1[data1$year==2001,]
un_hrc2002 <- data1[data1$year==2002,]
un_hrc2003 <- data1[data1$year==2003,]
un_hrc2004 <- data1[data1$year==2004,]
un_hrc2005 <- data1[data1$year==2005,]
un_hrc2006 <- data1[data1$year==2006,]
un_hrc2007 <- data1[data1$year==2007,]
un_hrc2008 <- data1[data1$year==2008,]
un_hrc2009 <- data1[data1$year==2009,]
un_hrc2010 <- data1[data1$year==2010,]
un_hrc2011 <- data1[data1$year==2011,]
un_hrc2012 <- data1[data1$year==2012,]
un_hrc2013 <- data1[data1$year==2013,]

m1998 <- mean(un_hrc1998$latentmean) 
m1999 <- mean(un_hrc1999$latentmean) 
m2000 <- mean(un_hrc2000$latentmean) 
m2001 <- mean(un_hrc2001$latentmean) 
m2002 <- mean(un_hrc2002$latentmean) 
m2003 <- mean(un_hrc2003$latentmean) 
m2004 <- mean(un_hrc2004$latentmean) 
m2005 <- mean(un_hrc2005$latentmean) 
m2006 <- mean(un_hrc2006$latentmean) 
m2007 <- mean(un_hrc2007$latentmean) 
m2008 <- mean(un_hrc2008$latentmean) 
m2009 <- mean(un_hrc2009$latentmean) 
m2010 <- mean(un_hrc2010$latentmean) 
m2011 <- mean(un_hrc2011$latentmean) 
m2012 <- mean(un_hrc2012$latentmean) 
m2013 <- mean(un_hrc2013$latentmean) 

c1998 <- mean(hrc1998$latentmean) 
c1999 <- mean(hrc1999$latentmean) 
c2000 <- mean(hrc2000$latentmean) 
c2001 <- mean(hrc2001$latentmean) 
c2002 <- mean(hrc2002$latentmean) 
c2003 <- mean(hrc2003$latentmean) 
c2004 <- mean(hrc2004$latentmean) 
c2005 <- mean(hrc2005$latentmean) 
c2006 <- mean(hrc2006$latentmean) 
c2007 <- mean(hrc2007$latentmean) 
c2008 <- mean(hrc2008$latentmean) 
c2009 <- mean(hrc2009$latentmean) 
c2010 <- mean(hrc2010$latentmean) 
c2011 <- mean(hrc2011$latentmean) 
c2012 <- mean(hrc2012$latentmean) 
c2013 <- mean(hrc2013$latentmean) 

adjust <- 0.25
y1 <- c(m1998,m1999,m2000,m2001,m2002,m2003,m2004,m2005,m2006,m2007,m2008,m2009,m2010,m2011,m2012,m2013)
x1 <- c(1998:2013)

y2 <- c(c1998,c1999,c2000,c2001,c2002,c2003,c2004,c2005,c2006,c2007,c2008,c2009,c2010,c2011,c2012,c2013)
x2 <- c(1998:2013)


plot(x1,y1,main="Western Europe and Others",xlab="Year",xlim=c(1998,2013),ylim=c(1.5,3),pch=19,col="dodgerblue",frame.plot=T,axes=F,ylab="Human Rights Score")
points(x2,y2,col="coral",pch=21)

abline(v=2005.5,lty=2)
lines(x1, y1, type = "l",col="dodgerblue",lwd=3)
lines(x2, y2, type = "l",col="coral")



x.axis <- c(1998:2013)
X <- c("'98","'99","'00","'01","'02","'03","'04","'05","'06","'07","'08","'09","'10","'11","'12","'13")
axis(1,at = x.axis,labels=X)

y.axis <- c(1.5,2.25,3)
Y <- c("1.5","2.25","3.0")
axis(2,at = y.axis,labels=Y)

